home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight Missions Cog Script
- #
- # EXP_FLASH.COG
- #
- # EXPLOSION SCRIPT - Flash Bomb
- #
- # [RF]
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
-
- symbols
-
- message created
-
- # Concussion damage explosion (very mild, but wide)
- template conc_exp=+flashbomb_exp local
-
- # Fire damage explosion (nasty, but narrow)
- template fire_exp=+flashfire_exp local
-
- sound outSound=pistout1.wav local
-
- thing flashb local
- thing blinded local
-
- vector tempvec local
- flex tempflex local
-
- vector blindedpos local
- vector flashbpos local
-
- int flashbdist local
-
- flex blindradius=30.0 local
- flex maxblindtime=10.0 local
- flex blindtime local
-
- end
-
- # ========================================================================================
-
- code
-
- created:
- flashb = GetSenderRef();
-
- // CreateThingNR(conc_exp, flashb);
- // CreateThingNR(fire_exp, flashb);
-
- flashbpos = GetThingPos(flashb);
-
- // Do we need to blind ourselves?
- blinded = GetLocalPlayerThing();
- blindedpos = GetThingPos(blinded);
-
- flashbdist = VectorDist(blindedpos, flashbpos) * 10;
-
- if (flashbdist < (blindradius * 3))
- if (!(GetActorFlags(blinded) & 0x100)) // Inanimate
- if (HasLOS(blinded, flashb))
- {
- // If this is our flashbomb, then blink.
- if (GetThingParent(flashb) == blinded)
- {
- SendMessageEx(GetThingClassCog(blinded), skill, 1036, -1, 0, 0);
- }
- else
- {
- blindtime = -2.0; // Signal that we should see the
- // flash, but not be blinded.
-
- if (HasLOS(blinded, flashb))
- if (flashbdist <= blindradius)
- {
- tempvec = VectorSub(flashbpos, blindedpos);
- tempvec = VectorNorm(tempvec);
- tempflex = VectorDot(tempvec, GetThingLVec(blinded));
-
- // Flash bomb is in view.
- if (tempflex >= 0.60)
- blindtime = (maxblindtime * (blindradius - flashbdist)) / blindradius;
- }
-
- SendMessageEx(GetThingClassCog(blinded), skill, 1036, blindtime, 0, 0);
- }
- }
-
- // If we are a client, stop here.
- if (IsMulti())
- if (!IsServer())
- {
- DestroyThing(flashb);
- Return;
- }
-
- // print("Looking...");
-
- // Check for other actor targets.
- blinded = FirstThingInView(flashb, 180, blindradius, 0x004);
-
- while (blinded != -1)
- {
- // print("Found something...");
-
- // // Don't mess with inanimate objects.
- // if (!(GetActorFlags(blinded) & 0x100))
- // // Don't mess with other players.
- // if (!(GetThingFlags(blinded) & 0x400))
- // Double check LOS.
- if (HasLOS(blinded, flashb))
- {
- blindedpos = GetThingPos(blinded);
-
- flashbdist = VectorDist(blindedpos, flashbpos) * 10;
-
- blindtime = (maxblindtime * (blindradius - flashbdist)) / blindradius;
-
- if (blindtime > 0) // Sanity check.
- {
- // Give the thing a chance to react.
- if (SendMessageEx(GetThingClassCog(blinded), skill, 1036, blindtime, blinded, 0) != 17)
- {
- // Before going into the default handler.
- SendMessageEx(GetInvCog(GetLocalPlayerThing(), 134), user0, blinded, blindtime, 0, 0);
- }
- }
- }
- //else
- //{
- //print("No LOS!");
- //}
- // else
- // {
- // print("Thing Flags: ");
- // printint(GetThingFlags(blinded));
- // }
- // else
- // {
- // print("Actor Flags: ");
- // printint(GetActorFlags(blinded));
- // }
-
- blinded = NextThingInView();
- }
-
- // Buh bye.
- DestroyThing(flashb);
- Return;
- end
-